FIO-8724: Fixed firing change event for DataGrid component #5933
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Link to Jira Ticket
https://formio.atlassian.net/browse/FIO-8724
Description
Original issue
Issue: Any change to the data grid (e.g., adding or removing a row) or any change to a nested component within the data grid should trigger a data grid change event and refresh the select component based on the refresh on data grid configuration. Change events are only fired for the nested component itself, not for the entire data grid.
Solution: The Edit Grid component fires change events when a row is saved or removed. However, the Data Grid should be treated as a special case of the Edit Grid, where any change to a nested component triggers a row save. Therefore, we need to track change events in the data grid and fire an additional event for the entire data grid component. This will ensure that the select component can refer to the data grid for refreshing.
Failing test case: Should trigger the correct conditional when a nested form uses the same key as a parent form.
Issue: Previously, to check nested form conditions, we used subform data. However, with recent path changes, the logic was modified to pass the entire form data to the nested form conditions check. As a result, conditions for the nested form are checking data for the entire form instead of only the nested form data. Additionally, the test case isn't consistently detectable because the webform and nested form call the
triggerChange
method independently, causing a race condition during the conditions check. Increasing the timeout leads to 100% reproduction of the failing test case.Solution: Pass only the nested form data to the condition check process.
How has this PR been tested?
Unit testing
Checklist: